<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>作者登录-墨阅小说网站</title>
</head>
<script type="text/javascript" src="../../js/jquery-3.6.0.min.js"></script>
<style>
    body{
        background-image: url(../../img/authorBac.jpg);
        width: 100%;
        height: 100%;
    }
</style>
<div th:include="common/style"></div>
<body>
<div class="bac">
<form>
    <input type="hidden" value="3" name="uRoleid">
    <table class="login">
        <tr>
            <td colspan="2">
                <h2 class="cen">作者账号登录</h2>
            </td>
        </tr>
        <tr>
            <td class="left">用户名：</td>
            <td>
                <input type="text" name="uName">
            </td>
        </tr>
        <tr>
            <td class="left">密码：</td>
            <td>
                <input type="password" name="uPwd"><br>
                <span id="sp1"></span>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="cen">
                <input type="button" onclick="userLogin()" value="登录" class="btn-primary">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <span class="tip" style="text-align: right">
                    还不是作者？<a th:href="@{toRegisterAuthor}">立即注册</a>
                <a href="#">忘记密码</a></span>
            </td>
        </tr>
    </table>
</form>
</div>
</body>
<script>
    function userLogin(){
        $.ajax({
            url:"userLogin",
            type:"post",
            data:$("form").serialize(),
            dataType:"text",
            success:function (data){
                if(data == 1){
                    $("#sp1").html("<font color='red' size='2'>您还不是作者，或密码错误</font>");
                }
                if(data == "success"){
                    location.href = "/author/authorFirst";
                }
            },error:function (){
                alert("登录失败");
            }
        })
    }
</script>
</html>